﻿/// Write a program that compares two char arrays lexicographically (letter by letter).


using System;

class zad_3
{
    static void Main(string[] args)
    {
        char[] arr1 = { 'f', 'k', 'r' };
        char[] arr2 = { 'a', 'k', 'r' };

        int len1 = arr1.GetLength(0);
        int len2 = arr2.GetLength(0);

        int minLenght = Math.Min(len1, len2);
        bool first = false;
        bool second = false;

        for (int i = 0; i < minLenght; i++)
        {
            if (arr1[i] == arr2[i])
            {
                continue;
            }
            else if (arr1[i] < arr2[i])
            {
                first = true;
                break;
            }
            else
            {
                second = true;
                break;
            }
        }

        if (len1 == len2 && first == false && second == false)
        {
            Console.WriteLine("the arrays are equal.");
        }
            // all elements are equal for the lenght of first OR first is!
        else if ( first || (len1 < len2 && first == false && second == false))
        {
            Console.WriteLine("first array ");
        }
        else
        {
            Console.WriteLine("second array ");
        }
    }
}

